/*
 * ProgramChair.java
 * Author: Russell Sowell
 */

package superConference;

import java.util.ArrayList;
import java.util.List;

/**
 * Class used to represent ProgramChairs.
 * @author Russell
 * @updated 11/20/2013
 */
public class ProgramChair extends AbstractUser
{
	/**
	 * Constructor to initialize base values
	 * @param userID ID associated with programchair
	 * @param email Email associated with programchair
	 * @param name Name associated with programchair
	 */
	ProgramChair(int userID, String email, String name) 
	{
		super(userID, email, name);
	}
	
	/**
	 * Accepts or rejects a paper due to input from the user. 
	 * @param accept Boolean value that is the ProgramChair's decision on the paper.
	 * @param thePaper The paper in question.
	 */
	public void acceptOrReject(boolean accept, Paper thePaper)
	{
		thePaper.accept(accept);
	}
	
	/**
	 * Designates a reviewer as a subprogram chair. Per BR06.
	 * @param theReviewer The reviewer to be appointed to SubProgramChair.
	 * @param theID The new ID number for this user's new login. Should be Conference user count + 1.
	 * @return Returns the new SubProgramChair user object to be inserted into conference.
	 */
	public SubProgramChair designateSubChair(Reviewer theReviewer, int theID)
	{
		SubProgramChair theSubChair = new SubProgramChair(theID, theReviewer.getEmail(), 
														theReviewer.getName());
		return theSubChair;
	}
	
	/**
	 * Assigns a paper to a SubProgramChair if the chair does not have 4 papers already and is not the
	 * author of the paper in question.
	 * @param theSubChair SubProgramChair for the paper to be added to.
	 * @param thePaper The Paper to be added to the SubProgramChair
	 */
	public void assignPaper(SubProgramChair theSubChair, Paper thePaper)
	{
		ArrayList<Paper> theSubChairPapers = theSubChair.getPaper(); 
		//Has the subchair reached their paper limit(4 BR18)? Are they the author of this paper?
		
		if (theSubChairPapers.size() < 4 && !theSubChairPapers.contains(thePaper))
		{
			theSubChair.addPaper(thePaper);
		}
	}
	
}
